package com.kongwg.java1;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author kongwg
 * @create 2020-12-23 15:23
 */
public class InetAddressTest {


    public static void main(String[] args) {

        try {
            InetAddress inet1 = InetAddress.getByName("192.168.10.1");
            System.out.println(inet1);

            InetAddress inet2 = InetAddress.getByName("www.bsllx.cn");

            System.out.println(inet2);


            System.out.println(inet2.getHostName());;
            System.out.println(inet2.getHostAddress());;
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }
}
